package ddemo.service;

import ddemo.dao.InterfaceMapper;
import ddemo.dao.UserMapper;
import ddemo.factory.MapperProxyFactory;
import ddemo.pojo.Interface;
import ddemo.pojo.User;

import java.util.List;

public class InterfaceService {
    private static InterfaceMapper interfaceMapper = MapperProxyFactory.getMapper(InterfaceMapper.class);

    public static int UpdateStatus(String status,Integer id,Integer userid){
        return interfaceMapper.UpdateStatu(status,id,userid);
    }
    public static int addInterface(int id) {
        String usestatus="可用";
        Integer userid=0;
        return interfaceMapper.addInterface(id,usestatus,userid);
    }

    public static void deleteInterface(int id) {
        interfaceMapper.deleteInterface(id);
    }

    public static List<Interface> getInterfaces() {
        return interfaceMapper.getinterface();
    }

    public static Interface isChongdian(User user) {
        return interfaceMapper.isChongdian(user.getId());
    }

    public static int stopUse(Integer id) {
        String usestatus="可用";
        Integer userid=0;
        return interfaceMapper.stopUse(id,usestatus,userid);
    }
    public static List<Interface> searchIntegers(Integer chargerid){
        return interfaceMapper.searchInterface(chargerid);
    }


}
